<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>composition API-setup</title>
  <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
  <div id="root"></div>
</body>
<script>
  
  const app = Vue.createApp({
    template: `
      <div @click="handleClick">name: {{name}}</div>
    `,
		methods:{
			test(){
				console.log(this.$options.setup())
			}
		},
		mounted() {
			this.test()
		},
		//created 实例被完全初始化之前， 2个参数 props context 上下文
		// 不能使用this this不存在
		// setup 无法调用 实例上的方法，实例初始化后 实例上的方法可以调用setup的方法

		//callback: Function as PropType<()=>void>,
  	//person: Object as PropType<Person>,
		//list: Array as PropType<AppItemModel[]>,
		setup(props,context) {
			
			return {
				name:'dell',
				handleClick:()=>{
					alert(123)
				}
			}
		}
  });
  const vm = app.mount('#root');
</script>
</html>